package demo516;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Demo {
    public static void main(String[] args) {

        Emp emp1=new Emp();
        emp1.setNumber("1001");
        emp1.setName("后羿");
        emp1.setAge(18);

        Emp emp2=new Emp();
        emp2.setNumber("1002");
        emp2.setName("安琪拉");
        emp2.setAge(19);

        Emp emp3=new Emp();
        emp3.setNumber("1003");
        emp3.setName("小乔");
        emp3.setAge(19);

        System.out.println(emp3.getNumber());
        System.out.println(emp3.getName());
        System.out.println(emp3.getAge());

        TestList testList=new TestList();
        List<Emp> list=new ArrayList();
        testList.addEmp(list,emp1);
        testList.addEmp(list,emp2);
        testList.addEmp(list,emp3);

        testList.findAllEmp(list);

        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入你需要查询的姓名");
        Emp emp=testList.findEmpName(list,scanner.next());
        System.out.println(emp);

        System.out.println("请输入你需要删除的员工编号");
        String number=scanner.next();
        testList.deletEmpNumber(list,number);

        System.out.println("请输入你需要删除的员工编号");
        String findNumber=scanner.next();
        Emp findEmp=testList.findEmpNumber(list,findNumber);
        System.out.println(findEmp);

//6
        System.out.println("请输入你要修改的员工编号");
        String updateNumber=scanner.next();
        Emp updateEmp=testList.findEmpNumber(list,updateNumber);

        System.out.println("请输入你需要修改的员工年龄");
        int updateAge= scanner.nextInt();
        updateEmp.setAge(updateAge);
        testList.updateEmpAge(list,updateEmp);

    }

}
